<?php
class admin_users extends Model{

    public function __construct() {
        parent::__construct();
    }
	
	public function op_login($data) {
		$flag = false;
		$sql = 'SELECT * FROM ' . $this->db_config['db_prefix'] .'admin_users WHERE status = 1 AND'. F_sqls($data);
		if ($item = $this->db->getOne($sql)) {
			$flag = true;
			$_SESSION['bc_backend']['user_id'] = $item['user_id'];
			$_SESSION['bc_backend']['role_id'] = $item['role_id'];
			$_SESSION['bc_backend']['username'] = $item['username'];
			$_SESSION['bc_backend']['email'] = $item['email'];
		}
		
		return $flag;
	}
	
	public function op_logined_user_info() {
		if ($_SESSION['bc_backend']['user_id']) {
			$sql = 'SELECT * FROM ' . $this->db_config['db_prefix'] .'admin_users WHERE user_id = '. $_SESSION['bc_backend']['user_id'];
			$item = $this->db->getOne($sql);
			return $item;
		} else {
			return false;
		}
	}

}
?>
